package com.fwixvye.utils;

import cn.hutool.json.JSONUtil;
import com.fwixvye.pojo.Role;
import com.fwixvye.pojo.rolePack.*;

import java.util.LinkedHashMap;

public class CalculationUtil {


    /**
     * 用来区分角色，
     *
     * @param role 前台 SubmitForCalculation按钮 提交过来的角色
     */
    public LinkedHashMap<String, Double> distinguishingRoles(Role role) {

        LinkedHashMap<String, Double> linkedHashMap = new LinkedHashMap<>();

        switch (role.name) {
            case "班尼特": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R040班尼特 rolePack = JSONUtil.toBean(jsonStr, R040班尼特.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "嘉明": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R041嘉明 rolePack = JSONUtil.toBean(jsonStr, R041嘉明.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "迪卢克": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R051迪卢克 rolePack = JSONUtil.toBean(jsonStr, R051迪卢克.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "迪西雅": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R051迪西雅 rolePack = JSONUtil.toBean(jsonStr, R051迪西雅.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "行秋": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R140行秋 rolePack = JSONUtil.toBean(jsonStr, R140行秋.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "芭芭拉": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R143芭芭拉 rolePack = JSONUtil.toBean(jsonStr, R143芭芭拉.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "妮露": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R150妮露 rolePack = JSONUtil.toBean(jsonStr, R150妮露.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "神里绫人": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R150神里绫人 rolePack = JSONUtil.toBean(jsonStr, R150神里绫人.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "琳妮特": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R240琳妮特 rolePack = JSONUtil.toBean(jsonStr, R240琳妮特.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "早柚": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R241早柚 rolePack = JSONUtil.toBean(jsonStr, R241早柚.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "枫原万叶": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R250枫原万叶 rolePack = JSONUtil.toBean(jsonStr, R250枫原万叶.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }
            case "琴": {
                String jsonStr = JSONUtil.toJsonStr(role);
                System.out.println(jsonStr);
                R250琴 rolePack = JSONUtil.toBean(jsonStr, R250琴.class);
                linkedHashMap = rolePack.singleRoleComputing();
                break;
            }

        }


        return linkedHashMap;
    }

}
